package org.cid54.bukkit.command;

import org.bukkit.event.player.PlayerChatEvent;
import org.cid54.bukkit.Cid54PlayerListener;
import org.cid54.bukkit.command.util.PlayerCommand;
import org.cid54.bukkit.model.AquamanRegister;

/**
 *
 * @author fgo
 */
public class AquamanCommand implements PlayerCommand {

    private AquamanRegister register = AquamanRegister.instance;

    public boolean execute(String command, PlayerChatEvent event, Cid54PlayerListener listener) {

        String[] commands = command.split(" ");

        if (commands.length > 1) {

            String state = commands[1].toLowerCase();

            if (state.equals("on")) {

                register.addPlayer(event.getPlayer());

            } else if (state.equals("off")) {

                register.removePlayer(event.getPlayer());

            }

            return true;
        } else {

            return false;

        }

    }

    public String getCommand() {
        return "aquaman";
    }

    public String getHelpText() {
        return "aquaman on|off. Let's you breathe underwater";
    }
}
